﻿@model IEnumerable<Consumer.Models.Course>

@{
    ViewBag.Title = "Home Page";
}

<div class="jumbotron">
    <h1>LTI Tool Consumer</h1>
    <p class="lead">
        To learn more about LTI visit
        <a href="http://developers.imsglobal.org/" title="IMS Global Learning Consortium Website">http://developers.imsglobal.org/</a>.
        The page features <mark>tutorials, and samples</mark> to help you get the most from LTI.
        If you have any questions about LTI visit
        <a href="http://developers.imsglobal.org/forum.html" title="IMS Global Learning Consortium Developer Forum">the IMS developers forum</a>.
    </p>
</div>
<div class="row">
    <div class="col-md-4">
        <h2>Enroll in a Course</h2>
        <p>
            @if (!Request.IsAuthenticated)
            {
                <text>Register or login and enroll</text>
            }
            else
            {
                <text>Enroll</text>
            }
            in a course. Courses are simple collections of assignments.
            Assignments are links to content or tools provided by LTI Tool Providers.
        </p>
    </div>
    <div class="col-md-4">
        <h2>Launch an Assignment</h2>
        <p>
            Launch an assignment to see the content or tool at the other end. Try
            changing your role (teacher or student) in your Profile and try again.
            Many Tool Providers will show a different user experience depending on your role.
        </p>
    </div>

    <div class="col-md-4">
        <h2>Check out the source code</h2>
        <p>All of the source code for this application is available on <a target="_blank" href="https://ltisamples.codeplex.com/">CodePlex</a>.</p>
    </div>
</div>

<div class="row">
    <div class="col-md-4">
        @if (Request.IsAuthenticated)
        {
            if (!Model.Any())
            {
                <h3>Courses</h3>
                <p>There are no courses yet.</p>
            }
            else
            {
                <table class="table">
                    <tr>
                        <th>Course</th>
                        <th>Instructor</th>
                    </tr>

                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>
                                @Html.ActionLink(item.Name, "Details", "Course", new { id = item.CourseId }, null)
                            </td>
                            <td>
                                @item.Instructor.FullName
                            </td>
                        </tr>
                    }

                </table>
            }
        }
        else
        {
            <h3>Courses</h3>
            <p>Please register or log in to see the list of available courses.</p>
        }

    </div>
</div>